package com.example.demo2_review.demo_string;

import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.Locale;

/**
 * @Author zwp14
 * @create 2024/7/16 16:50
 * @description String常用方法
 */
public class StringInCommonUse {
    public static void main(String[] args) {
        String str = "GwpZHEN@163.com";
        System.out.println("str.length() = " + str.length());
        System.out.println(Arrays.toString(str.getBytes(StandardCharsets.UTF_8)));
        System.out.println(str.indexOf("@"));
        System.out.println("str.split(\"@\") = " + Arrays.toString(str.split("@")));
        System.out.println("str.replace(\"@\",\"$\") = " + str.replace("@", "$"));
        System.out.println("str.replaceAll(\"@\",\"%\") = " + str.replaceAll("@", "%"));
        System.out.println("str.substring(7) = " + str.substring(7));
        System.out.println("str.toLowerCase(Locale.ROOT) = " + str.toLowerCase());
        System.out.println("str.toUpperCase() = " + str.toUpperCase());
    }
}
